package com.easyweb.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.easyweb.dao.ArticleDao;
import com.easyweb.dao.BaseDao;
import com.easyweb.model.Article;
@Repository
public class ArticleDaoImpl extends BaseDao implements ArticleDao{

	public int insertArticle(Article article) {
		return getSqlSession().insert("article.insertArticle",article);
	}

	public int deleteArticleById(Map<String, Object> map) {
		return getSqlSession().delete("article.deleteArticleById", map);
	}

	public int updateArticle(Article article) {
		return getSqlSession().update("article.updateArticleById", article);
	}

	public List<Article> getArticles(Map<String, Object> map) {
		return getSqlSession().selectList("article.selectArticles", map);
	}

	public Article getArticleById(Map<String, Object> map) {
		return getSqlSession().selectOne("article.selectArticles", map);
	}

	public List<Article> getArticlesNoContent(Map<String, Object> map) {
		return getSqlSession().selectList("article.selectArticlesNoContent", map);
	}

	public List<Article> getIndexArticle(Map<String, Object> map) {
		return getSqlSession().selectList("article.selectIndexArticle", map);
	}

	public List<Article> getSortArticleByRead(Map<String, Object> map) {
		return getSqlSession().selectList("article.selectSortArticleByRead", map);
	}

	public int getArticlesNoContentCount(Map<String, Object> map) {
		return getSqlSession().selectOne("article.selectArticlesNoContentCount", map);
	}

	public int getIndexArticleCount(Map<String, Object> map) {
		return getSqlSession().selectOne("article.selectIndexArticleCount", map);
	}

}
